/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.behavioral.iterator;

/**
 *
 * @author jmg
 */
public class MyArraryListIterator<T> implements Iterator<T>{

    private MyArraryList<T> myArraryList;
    private int index = 0 ;
    
    public MyArraryListIterator(MyArraryList<T> myArraryList) {
        this.myArraryList = myArraryList;
    }
    
    @Override
    public boolean hasNext() {
       return index < myArraryList.size();
    }

    @Override
    public T next() {
      T t = myArraryList.get(index);
      index++;  
      return t;
    }
    
}
